package cn.kgc.service.impl;

import cn.kgc.dao.TeacherDao;
import cn.kgc.dao.impl.TeacherImpl;
import cn.kgc.entity.Teacher;
import cn.kgc.service.TeacherService;

import java.util.List;

public class TeacherServiceImpl implements TeacherService {

    @Override
    public List<Teacher> search(int currentPage,int currentSize,String jobnum,String name,String specialty) {
        TeacherDao teacherDao = new TeacherImpl();
        List<Teacher> teacherList = teacherDao.search(currentPage,currentSize,jobnum,name,specialty);
        return teacherList;
    }

    @Override
    public int totalCount(String jobnum,String name,String specialty) {
        TeacherDao teacherDao = new TeacherImpl();
        return teacherDao.totalCount(jobnum,name,specialty);
    }
    //增加;
    public int add(Teacher teacher){
        TeacherDao teacherDao = new TeacherImpl();
        return  teacherDao.add(teacher);
    }

    @Override
    public int totalPage(int pageSize,String jobnum,String name,String specialty) {
        TeacherDao teacherDao = new TeacherImpl();
        return teacherDao.totalPage(pageSize,jobnum,name,specialty);
    }

    @Override
    public Teacher findById(String ids) {
        TeacherDao teacherDao = new TeacherImpl();
        Teacher teacher = teacherDao.getById(ids);
        return teacher;
    }

    @Override
    public int modifyTeacher(Teacher teacher) {
        TeacherDao teacherDao = new TeacherImpl();
        int count = teacherDao.updateTeacher(teacher);
        return count;
    }
}
